package cn.microservices.cloud.gateway.filter;//package com.microservice.gateway.filter;
//
//import com.microservice.gateway.interpector.ip.IpInterceptor;
//import com.microservice.gateway.interpector.rquest.OnceRequestInterceptor;
//import com.microservice.gateway.util.WebFluxUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.http.server.reactive.ServerHttpResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.web.server.ServerWebExchange;
//import org.springframework.web.server.WebFilter;
//import org.springframework.web.server.WebFilterChain;
//import reactor.core.publisher.Mono;
//
//@Component
//public class GlobalWebFilter implements WebFilter {
//
//	@Autowired
//	private IpInterceptor ipInterceptor;
//
//	@Autowired
//	private OnceRequestInterceptor onceRequestInterceptor;
//
//	@Override
//	public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
//		ServerHttpRequest request = exchange.getRequest();
//		ServerHttpResponse response = exchange.getResponse();
//
//		//ip拦截
//		if (ipInterceptor.isIllegalByIp(request)) {
//			return WebFluxUtil.echo(response);
//		}
//
//
//		//一次请求
//		if (onceRequestInterceptor.isInvalid(request)) {
//			return WebFluxUtil.echo(response);
//		}
//
//		return chain.filter(exchange);
//	}
//
//
//}
